<style type="text/css">
    /*#resourceModal {*/
        /*left:39%*/
    /*}*/
</style>
<h3 class="page-title">合同管理</h3>
<div class="tabbable-custom">
    <div class="portlet">
        <div class="portlet-title">
            <button class="btn btn-success title-action" ng-click="contractGrid.add()"
                    tabindex="0">
                <i class="fa fa-plus"></i> 新增合同
            </button>
            <a href="javascript:void(0);" class="title-operation search-expand">筛选</a>

            <div class="title-search-box">
                <input type="text" placeholder="请输入合同编号" class="search-field"
                       style="width: 180px;" maxlength="100" ng-model="contractGrid.query.contractNo">
                <a class="fa fa-search" ng-click="contractGrid.query()"></a>
            </div>
        </div>
        <div class="portlet-search-body" style="display: none;">
            <form class="form-inline" role="form">
                <div class="form-group">
                    <div class="col-md-4">
                        <div class="input-icon">
                            <i class="fa fa-user"></i>
                            <input class="form-control" placeholder="合同编号" ng-model="contractGrid.query.contractNo">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-4">
                        <div class="input-icon">
                            <i class="fa fa-user"></i>
                            <select class="form-control" style="width: 200px;color: #b3b3b3;"  ng-model="contractGrid.query.sourceType"
                                    ng-options="opt.value as opt.name for opt in options.sourceType">
                                    <option  value="">-- 合同类别 --</option>
                            </select>
                            
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-4">
                        <div class="input-icon">
                            <i class="fa fa-user"></i>
                            <select class="form-control" style="width: 200px;color: #b3b3b3;" ng-model="contractGrid.query.customerId" ng-options="opt.customerId as opt.customerName for opt in customerList">
								<option value="" >--经营单位-- </option>
							</select>
                        </div>
                    </div>
                </div>
                <button class="btn btn-primary" ng-click="contractGrid.query(contractGrid.query.quickSearch = 0)"><i class="fa fa-search"></i> 搜索</button>
				<button class="btn btn-primary" ng-click="contractGrid.reset()">
					<i class="fa fa-rotate-left"></i> 重置
				</button>
			</form>
        </div>
        <div class="portlet-body" style="width: 100%">
            <table ed-grid="contractGrid" class="table table-striped table-bordered table-hover dataTable"
                   ed-url="contract/query.do" ed-model="contract" style="width: 100%">
                <thead>
                <tr>
                    <th ed-data="_index"></th>
                    <th ed-data="contractNo">合同编号</th>
                    <th ed-data="sourceType | code : 'sourceType'">合同类型</th>
                    <th ed-data="customerName">客户名称</th>
                    <th ed-data="contractAmount">合同金额(￥)</th>
                    <th ed-data="amountReceivables">应收账款(￥)</th>
                    <th ed-data="amountReceived">实收账款(￥)</th>
                    <th ed-data="contractDate | limitTo : 10">合同日期</th>
                    <th width="200px">操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
</div>

<div ed-modal="contractAddModal" data-options="width:'1000px', static:true,icon: 'fa-user'">
    <div class="form" style="overflow: auto;height: 600px;">
            <form action="#" class="form-horizontal form-row-seperated w5c-form" w5c-form-validate novalidate name="validateForm">
                <div class="form-body">
                	<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-4 control-label"><span class="required">*</span>合同编号</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control" name="contractNo"
		                                   ng-model="contractAddModal.contract.contractNo" required>
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-3 control-label"><span class="required">*</span>合同类型</label>
		                        <div class="col-md-8">
		                            <select class="form-control" name="sourceType" ng-model="contractAddModal.contract.sourceType"
                                    ng-options="opt.value as opt.name for opt in options.sourceType" required></select>
		                        </div>
		                    </div>
		              	</div>
	           		</div>
	           		
	           		<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-4 control-label"><span class="required">*</span>经营单位</label>
		                        <div class="col-md-8">
		                            <select class="form-control" name="customerId" ng-model="contractAddModal.contract.customerId"
                                    ng-options="opt.customerId as opt.customerName for opt in customerList" required></select>
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                    	<label class="col-md-3 control-label"><span class="required">*</span>合同日期</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control" name="contractDate" ed-date-picker
                                   ng-model="contractAddModal.contract.contractDate" required>
		                        </div>
		                        
		                    </div>
		              	</div>
	           		</div>
	           		<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                       	<label class="col-md-4 control-label">合同金额(元)</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control input-inline" name="contractAmount" ed-validate="double"
                                  	 ng-model="contractAddModal.contract.contractAmount">
		                        </div>
		                    </div>
		              	</div>
	           		</div>
	           		<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                       	<label class="col-md-4 control-label">应收账款(元)</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control input-inline" name="amountReceivables" ed-validate="double"
                                  	 ng-model="contractAddModal.contract.amountReceivables">
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                       	<label class="col-md-3 control-label">实收账款(元)</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control input-inline" name="amountReceived" ed-validate="double"
                                  	 ng-model="contractAddModal.contract.amountReceived">
		                        </div>
		                    </div>
		              	</div>
	           		</div>
	           <!-- <div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-4 control-label">资源导入</label>
		                        <div class="col-md-8">
		                            <div ed-uploader data-options="text:' 选择文件'" class="ng-uploader" ng-model="contractAddModal.importFile" ed-upload-dir="tmp">
                    				</div><a href="contract/downloadModel.do" style="margin-left: 10px;">模板下载</a>
                    				<br>{{contract.importFile.name}}
		                        </div>
		                    </div>
		              	</div>
	           		</div> -->
                </div>
            </form>
          <tabset ng-show="contractAddModal.contract.contractId" >
			<tab heading="车辆资源" ng-click="contractAddModal.clickBusTab()" active="contractAddModal.searchBus">
	          	<tabset>
					<tab heading="{{media.mediaName}}({{typeCounts[media.mediaId]}})" ng-click="contractAddModal.clickTab(media.mediaId)" ng-repeat="media in mediaTypes | filter : {parentId:'1'}">
						<div class="portlet">
							<div class="portlet-body">
								<table  ed-grid="mediaGrid_{{media.mediaId}}" ed-url="contract/mediaResources.do" class="table table-striped table-bordered table-hover dataTable" style="margin-left:5px;width: 99%;font-size: 9px;">
									<thead>
										<tr style="text-align: center">
											<th style="text-align: center" ed-data="_index"></th>
											<th style="text-align: center" ed-data="resourceInfo.resourceCode">资源编号</th>
											<th style="text-align: center" ed-data="busInfo.lineNo">线路</th>
											<th style="text-align: center" ed-data="busInfo.plateNo">车牌号</th>
											<th style="text-align: center" ed-data="busInfo.vehicleNo">自编号</th>
											<th style="text-align: center" ed-data="start2EndDate">经营起止日期</th>
											<th style="text-align: center;font-weight: bold;width: 17%;">
												<button class="btn btn-xs btn-success" ng-click="contractAddModal.toImport(media)"><i class="fa fa-plus"></i> 导入</button>
											</th>
										</tr>
									</thead>
								</table>
							</div>
						</div>
					</tab>
		    	</tabset>
	        </tab>
	        <tab heading="站点资源" ng-click="contractAddModal.clickStopTab()" active="contractAddModal.searchStop">
	          	<tabset>
					<tab heading="{{media.mediaName}}({{typeCounts[media.mediaId]}})" ng-click="contractAddModal.clickTab(media.mediaId)" ng-repeat="media in mediaTypes | filter : {parentId:'2'}">
						<div class="portlet">
							<div class="portlet-body">
								<table  ed-grid="mediaGrid_{{media.mediaId}}" ed-url="contract/mediaResources.do" class="table table-striped table-bordered table-hover dataTable" style="margin-left:5px;width: 99%;font-size: 9px;">
									<thead>
									<tr style="text-align: center">
										<th style="text-align: center" ed-data="_index"></th>
										<th style="text-align: center" ed-data="resourceInfo.resourceCode">资源编号</th>
										<th style="text-align: center" ed-data="stopInfo.stopName">站点</th>
										<th style="text-align: center" ed-data="stopInfo.roadName">街道</th>
										<th style="text-align: center" ed-data="stopInfo.direction">行向</th>
										<th style="text-align: center" ed-data="start2EndDate">经营起止日期</th>
										<th style="text-align: center;font-weight: bold;width: 17%;">
											<button class="btn btn-xs btn-success" ng-click="contractAddModal.toImport(media)"><i class="fa fa-plus"></i> 导入</button>
										</th>
									</tr>
									</thead>
								</table>
							</div>
						</div>
					</tab>

		    	</tabset>
	        </tab>
    	</tabset>
    </div>
</div>

<div ed-modal="contractImportModal" data-options="title:'合同资源明细导入',width:'500px', static:true,icon: 'fa-user'">
    <div class="form" style="overflow: auto;height: 200px;">
    	<form action="#" class="form-horizontal">
       		<div class="form-body">
               	<div class="row">
                   	<div class="col-md-12">
	                    <div class="form-group">
	                    	<label class="col-md-2 control-label"></label>
	                        <div class="col-md-10">
	                        	<div ed-uploader data-options="text:' 选择EXCEL数据文件',accept:'xls,xlsx'" class="ng-uploader" ng-model="contractImportModal.importFile" ed-upload-dir="tmp">
	                        	</div>
	                        	<a id="modelFileDownloadLink" href="contract/downloadModel.do?mediaId={{contractImportModal.media.mediaId}}" target="_blank" style="margin-left: 10px;">模板下载</a>
	                        </div>
	                    </div>
	              	</div>
           		</div>
           		<div class="row">
                   	<div class="col-md-12">
	                    <div class="form-group">
	                        <label class="col-md-2 control-label"></label>
	                        <div class="col-md-10">
	                        	{{contractImportModal.importFile.name}}
	                        </div>
	                    </div>
	              	</div>
           		</div>
           </div>
    	</form>
    </div>
</div>

<div ed-modal="contractViewModal" data-options="title:'合同明细',width:'1000px', static:true,icon: 'fa-user',defaultButton:false">
	<div class="form" style="overflow: auto;height: 600px;">
            <form action="#" class="form-horizontal form-row-seperated">
                <div class="form-body">
                	<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-4 control-label">合同编号：</label>
		                        <div class="col-md-8">
		                        	<p class='form-control-static'>{{contractViewModal.contract.contractNo}}</p>
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-3 control-label">合同类型：</label>
		                        <div class="col-md-8">
		                        	<p class='form-control-static'>{{contractViewModal.contract.sourceType | code : 'sourceType'}}</p>
		                        </div>
		                    </div>
		              	</div>
	           		</div>
	           		
	           		<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-4 control-label">客户名称：</label>
		                        <div class="col-md-8">
		                        	<p class='form-control-static'>{{contractViewModal.contract.customerName}}</p>
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-3 control-label">合同日期：</label>
		                        <div class="col-md-8">
		                        	<p class='form-control-static'>{{contractViewModal.contract.contractDate}}</p>
		                        </div>
		                    </div>
		              	</div>
	           		</div>
	           		<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                        <label class="col-md-4 control-label">合同金额：</label>
		                        <div class="col-md-8">
		                        	<p class='form-control-static'>{{contractViewModal.contract.contractAmount}}(￥)</p>
		                        </div>
		                    </div>
		              	</div>
	           		</div>
                </div>
            </form>
      	<tabset ng-show="contractViewModal.contract.contractId">
			<tab heading="车辆资源" ng-click="contractViewModal.clickBusTab();contractViewModal.viewSearchBus = true;" active="contractViewModal.viewSearchBus">
	          	<tabset>
					<tab heading="{{media.mediaName}}({{typeCounts[media.mediaId]}})" ng-click="contractViewModal.clickTab(media.mediaId)" ng-repeat="media in mediaTypes | filter : {parentId:'1'}">
						<div class="portlet">
							<div class="portlet-body">
								<table  ed-grid="mediaGridView_{{media.mediaId}}" ed-url="contract/mediaResources.do" class="table table-striped table-bordered table-hover dataTable" style="margin-left:5px;width: 99%;font-size: 9px;">
									<thead>
									<tr style="text-align: center">
										<th style="text-align: center" ed-data="_index"></th>
										<th style="text-align: center" ed-data="resourceInfo.resourceCode">资源编号</th>
										<th style="text-align: center" ed-data="busInfo.lineNo">线路</th>
										<th style="text-align: center" ed-data="busInfo.plateNo">车牌号</th>
										<th style="text-align: center" ed-data="busInfo.vehicleNo">自编号</th>
										<th style="text-align: center" ed-data="start2EndDate">经营起止日期</th>
									</tr>
									</thead>
								</table>
							</div>
						</div>
					</tab>
		    	</tabset>
	        </tab>
	        <tab heading="站点资源" ng-click="contractViewModal.clickStopTab()" active="contractViewModal.viewSearchStop">
	          	<tabset>
					<tab heading="{{media.mediaName}}({{typeCounts[media.mediaId]}})" ng-click="contractViewModal.clickTab(media.mediaId)" ng-repeat="media in mediaTypes | filter : {parentId:'2'}">
						<div class="portlet">
							<div class="portlet-body">
								<table  ed-grid="mediaGridView_{{media.mediaId}}" ed-url="contract/mediaResources.do" class="table table-striped table-bordered table-hover dataTable" style="margin-left:5px;width: 99%;font-size: 9px;">
									<thead>
									<tr style="text-align: center">
										<th style="text-align: center" ed-data="_index"></th>
										<th style="text-align: center" ed-data="resourceInfo.resourceCode">资源编号</th>
										<th style="text-align: center" ed-data="stopInfo.stopName">站点</th>
										<th style="text-align: center" ed-data="stopInfo.roadName">街道</th>
										<th style="text-align: center" ed-data="stopInfo.direction">行向</th>
										<th style="text-align: center" ed-data="start2EndDate">经营起止日期</th>
									</tr>
									</thead>
								</table>
							</div>
						</div>
					</tab>
		    	</tabset>
	        </tab>
    	</tabset>
    </div>
</div>
